﻿<phone:PhoneApplicationPage 
    x:Class="Omnia.Wallet.Views.GalleriesView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:viewmodel="clr-namespace:Omnia.ViewModels;assembly=Omnia.ViewModels"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False" xmlns:my="clr-namespace:Omnia.Converters;assembly=Omnia.Converters">
    <phone:PhoneApplicationPage.Resources>
        <my:BinaryToImageConverter x:Key="BinaryToImageConverter" />
        <my:ResourceKeyToPathdataConverter x:Key="ResourceKeyToPathdataConverter" />
        <my:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <my:StreamToImageConverter x:Key="StreamToImageConverter"/>
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
    	<Grid.Background>
    		<ImageBrush Stretch="{Binding GlobalSettings.BackgroundImageStretch}" ImageSource="{Binding BackgroundImageSource, Mode=OneWay}"/>
    	</Grid.Background>
        <Grid.DataContext>
            <viewmodel:GalleriesViewModel/>
        </Grid.DataContext>
        
        <controls:Pivot Title="{StaticResource IDS_PAGE_TITLE}">
            <controls:PivotItem Header="{StaticResource IDS_ITEM_HEADER_ISOSLATED}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <ListBox ItemsSource="{Binding Path=IsoSlatedPictures}" SelectedItem="{Binding Path=SelectedIsoSlatedPicture, Mode=TwoWay}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel></toolkit:WrapPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ListBoxItem">
                                            <Grid Margin="12,0,0,12">
                                                <Image Width="210" Height="210" 
                                                       Source="{Binding StreamInfo, Converter={StaticResource StreamToImageConverter}}" Stretch="Fill" />
                                                <Border BorderThickness="4" 
                                                        BorderBrush="{StaticResource PhoneForegroundBrush}" 
                                                        Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                    <Path Data="M51.790001,24.177999L44.657009,31.310526 42.412151,33.555641 42.360149,33.608337 40.141289,31.392622 33.010998,24.259096 33.010998,30.443459 39.294868,36.728317 42.38615,39.820999 45.479931,36.728317 45.45393,36.701019 45.505932,36.64822 51.790001,30.363361z M42.398598,16.777C50.804901,16.777 57.619999,23.591635 57.619999,32 57.619999,40.406467 50.804901,47.223 42.398598,47.223 33.9897,47.223 27.174,40.406467 27.174,32 27.174,23.591635 33.9897,16.777 42.398598,16.777z M0,0L31.899,0C40.984901,0.20117199,42.398998,8.6806602,42.398998,8.6806602L42.398998,13.110001 41.91222,13.116181C31.719772,13.375278 23.508001,21.74651 23.508001,31.99995 23.508001,42.252407 31.719772,50.623718 41.91222,50.88282L42.398998,50.889 42.398998,64 25.8801,47.848598 9.2863798,64 9.2863798,8.6806602C8.2785301,1.00879,0,0,0,0z" 
                                                          Stretch="Uniform" Fill="{StaticResource PhoneForegroundBrush}" Width="36" Height="36" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
                                                        <Path.RenderTransform>
                                                            <TransformGroup>
                                                                <TransformGroup.Children>
                                                                    <RotateTransform Angle="0" />
                                                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                                                </TransformGroup.Children>
                                                            </TransformGroup>
                                                        </Path.RenderTransform>
                                                    </Path>
                                                </Border>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </ListBox>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Button/>
                        <Button Content="{StaticResource IDS_LABEL_GALLERY_SETASBACKGROUND}" Command="{Binding Path=SetIsoSlatedCommand}" />
                        <Button Content="{StaticResource IDS_LABEL_GALLERY_CHOOSEMEDIALIBRARY}" Command="{Binding OpenMediaLibraryCommand, Mode=OneWay}" Grid.Column="1" />
                        <Button Content="{StaticResource IDS_LABEL_GALLERY_DELETEPICTURE}" Command="{Binding DeletePictureCommand, Mode=OneWay}" Grid.Column="2" />
                    </Grid>
                </Grid>
            </controls:PivotItem>

            <!--
            <controls:PivotItem Header="{StaticResource IDS_ITEM_HEADER_MEDIALIBRARY}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <ListBox ItemsSource="{Binding Path=MediaLibraryPictures}" SelectedItem="{Binding Path=SelectedMediaLibraryPicture, Mode=TwoWay}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel></toolkit:WrapPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ListBoxItem">
                                            <Grid Margin="12,0,0,12">
                                                <Image Width="210" Height="210" 
                                                       Source="{Binding StreamInfo, Converter={StaticResource StreamToImageConverter}}" Stretch="Fill" />
                                                <Border BorderThickness="4" 
                                                        BorderBrush="{StaticResource PhoneForegroundBrush}" 
                                                        Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                    <Path Data="M51.790001,24.177999L44.657009,31.310526 42.412151,33.555641 42.360149,33.608337 40.141289,31.392622 33.010998,24.259096 33.010998,30.443459 39.294868,36.728317 42.38615,39.820999 45.479931,36.728317 45.45393,36.701019 45.505932,36.64822 51.790001,30.363361z M42.398598,16.777C50.804901,16.777 57.619999,23.591635 57.619999,32 57.619999,40.406467 50.804901,47.223 42.398598,47.223 33.9897,47.223 27.174,40.406467 27.174,32 27.174,23.591635 33.9897,16.777 42.398598,16.777z M0,0L31.899,0C40.984901,0.20117199,42.398998,8.6806602,42.398998,8.6806602L42.398998,13.110001 41.91222,13.116181C31.719772,13.375278 23.508001,21.74651 23.508001,31.99995 23.508001,42.252407 31.719772,50.623718 41.91222,50.88282L42.398998,50.889 42.398998,64 25.8801,47.848598 9.2863798,64 9.2863798,8.6806602C8.2785301,1.00879,0,0,0,0z" 
                                                          Stretch="Uniform" Fill="{StaticResource PhoneForegroundBrush}" Width="36" Height="36" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
                                                        <Path.RenderTransform>
                                                            <TransformGroup>
                                                                <TransformGroup.Children>
                                                                    <RotateTransform Angle="0" />
                                                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                                                </TransformGroup.Children>
                                                            </TransformGroup>
                                                        </Path.RenderTransform>
                                                    </Path>
                                                </Border>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </ListBox>
                    <Button Content="设为背景" Grid.Row="1" Command="{Binding Path=SetMediaLibraryCommand}" />
                </Grid>
            </controls:PivotItem>
-->
            <controls:PivotItem Header="{StaticResource IDS_ITEM_HEADER_SKYDRIVE}">
                <Grid/>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->
    
</phone:PhoneApplicationPage>